<?php
namespace app\theme\controller;

use app\common\controller\Front;

class Index extends Front
{
    public function _initialize()
    {
        $this->request->filter('trim,strip_tags,htmlspecialchars');
        parent::_initialize();
    }
    
    //theme/index/index/apply/cms/view/default
    public function index()
    {
        $apply = input('apply/s');
        $view = input('view/s','default');
        if(!$apply){
            $this->error('请输入应用名');
        }
        if(!is_dir('./apps/'.DcDirPath($apply).'/theme/'.DcDirPath($view))){
            $this->error('模板不存在');
        }
        cookie('theme_'.$apply, $view);
        $this->redirect($this->request->root(true),302);
    }
}